package prastice;

import java.util.HashSet;

public class NumJewelsInStones {
    public int numJewelsInStones(String jewels, String stones) {
        HashSet<Character> set = new HashSet<>();
        for(int i = 0; i < jewels.length(); i++) {
            set.add(jewels.charAt(i));
        }

        int nums = 0;
    /*    for(int i = 0; i < stones.length(); i++) {
            if(set.contains(stones.charAt(i))) {
                nums++;
            }
        }*/
        for(char ch : stones.toCharArray()) {
            if(set.contains(ch)) {
                nums++;
            }
        }

        return nums;
    }
}
